/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.assg2.dao;

import com.movie.Movie;
import com.movie.Review;
import com.movie.Viewer;

/**
 *
 * @author Kevin
 */
public class DaoReview extends GenericDao {

    public DaoReview() {
        super(Review.class);
    }

    public void save(Review r, Viewer v, Movie m) {

        try {
            
            session.clear();
            session.beginTransaction();
            session.save(v);
            session.save(m);
            session.save(r);
            session.getTransaction().commit();
            session.close();


        } catch (Throwable e) {
            if (session.getTransaction().isActive()) {
                session.getTransaction().rollback();
            }

            System.out.println(e.getMessage());
        }
    }
}
